package com.yykj.user.center.server.repository;

import com.yykj.user.center.server.model.Doctor;
import com.yykj.user.center.server.model.Group;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface GroupRepository extends JpaRepository<Group, String>, JpaSpecificationExecutor<Group> {

    List<Group> findAllByNameAndTypeAndHospitalIdAndDoctorIdAndState(String name,Integer type,Integer hospitalId,String doctorId,Boolean state);

    Group findFirstByHospitalIdAndDoctorIdAndIsDefaultAndState(Integer hospitalId,String doctorId,Boolean isDefault,Boolean state);

    List<Group> findAllByDoctorIdAndTypeAndStateOrderByCreateTimeDesc(String doctorId,Integer type,Boolean state);
}
